function encoded_seq = rs_encode_31_15(input_seq)
    % Check if the input sequence length is a multiple of 5
    if mod(length(input_seq), 5) ~= 0
        error('Input sequence length must be a multiple of 5');
    end
    
    % Number of symbols in the input sequence
    num_symbols = length(input_seq) / 5;
    
    % Convert input 01 sequence to symbols
    symbols = zeros(1, num_symbols);
    for i = 1:num_symbols
        symbols(i) = bin2dec(num2str(input_seq((i-1)*5+1:i*5)));
    end
    
    % RS (31, 15) parameters
    n = 31;
    k = 15;
    
    % Pad the symbols to match the message length required for RS (31, 15)
    padded_symbols = [symbols, zeros(1, k - num_symbols)];
    
    % Convert to Galois field array
    gf_symbols = gf(padded_symbols, 5);
    
    % Encode the symbols using rsenc
    encoded_gf_symbols = rsenc(gf_symbols, n, k);
    
    % Convert encoded symbols to binary sequence
    encoded_seq = [];
    for i = 1:length(encoded_gf_symbols)
        encoded_seq = [encoded_seq, dec2bin(encoded_gf_symbols.x(i), 5) - '0'];
    end
end